(0) Obligation:

Runtime Complexity TRS:
The TRS R consists of the following rules:

flatten(nil) → nil
flatten(unit(x)) → flatten(x)
flatten(++(x, y)) → ++(flatten(x), flatten(y))
flatten(++(unit(x), y)) → ++(flatten(x), flatten(y))
flatten(flatten(x)) → flatten(x)
rev(nil) → nil
rev(unit(x)) → unit(x)
rev(++(x, y)) → ++(rev(y), rev(x))
rev(rev(x)) → x
++(x, nil) → x
++(nil, y) → y
++(++(x, y), z) → ++(x, ++(y, z))

Rewrite Strategy: FULL

(1) DecreasingLoopProof (EQUIVALENT transformation)

The following loop(s) give(s) rise to the lower bound Ω(n1):
The rewrite sequence
flatten(unit(x)) →+ flatten(x)
gives rise to a decreasing loop by considering the right hand sides subterm at position [].
The pumping substitution is [x / unit(x)].
The result substitution is [ ].

(2) BOUNDS(n^1, INF)

(3) RenamingProof (EQUIVALENT transformation)

Renamed function symbols to avoid clashes with predefined symbol.

(4) Obligation:

Runtime Complexity Relative TRS:
The TRS R consists of the following rules:

flatten(nil) → nil
flatten(unit(x)) → flatten(x)
flatten(++(x, y)) → ++(flatten(x), flatten(y))
flatten(++(unit(x), y)) → ++(flatten(x), flatten(y))
flatten(flatten(x)) → flatten(x)
rev(nil) → nil
rev(unit(x)) → unit(x)
rev(++(x, y)) → ++(rev(y), rev(x))
rev(rev(x)) → x
++(x, nil) → x
++(nil, y) → y
++(++(x, y), z) → ++(x, ++(y, z))

S is empty.
Rewrite Strategy: FULL

(5) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)

Infered types.

(6) Obligation:

TRS:
Rules:
flatten(nil) → nil
flatten(unit(x)) → flatten(x)
flatten(++(x, y)) → ++(flatten(x), flatten(y))
flatten(++(unit(x), y)) → ++(flatten(x), flatten(y))
flatten(flatten(x)) → flatten(x)
rev(nil) → nil
rev(unit(x)) → unit(x)
rev(++(x, y)) → ++(rev(y), rev(x))
rev(rev(x)) → x
++(x, nil) → x
++(nil, y) → y
++(++(x, y), z) → ++(x, ++(y, z))

Types:
flatten :: nil:unit → nil:unit
nil :: nil:unit
unit :: nil:unit → nil:unit
++ :: nil:unit → nil:unit → nil:unit
rev :: nil:unit → nil:unit
hole_nil:unit1_0 :: nil:unit
gen_nil:unit2_0 :: Nat → nil:unit

(7) OrderProof (LOWER BOUND(ID) transformation)

Heuristically decided to analyse the following defined symbols:
flatten, ++, rev

They will be analysed ascendingly in the following order:
++ < flatten
++ < rev

(8) Obligation:

TRS:
Rules:
flatten(nil) → nil
flatten(unit(x)) → flatten(x)
flatten(++(x, y)) → ++(flatten(x), flatten(y))
flatten(++(unit(x), y)) → ++(flatten(x), flatten(y))
flatten(flatten(x)) → flatten(x)
rev(nil) → nil
rev(unit(x)) → unit(x)
rev(++(x, y)) → ++(rev(y), rev(x))
rev(rev(x)) → x
++(x, nil) → x
++(nil, y) → y
++(++(x, y), z) → ++(x, ++(y, z))

Types:
flatten :: nil:unit → nil:unit
nil :: nil:unit
unit :: nil:unit → nil:unit
++ :: nil:unit → nil:unit → nil:unit
rev :: nil:unit → nil:unit
hole_nil:unit1_0 :: nil:unit
gen_nil:unit2_0 :: Nat → nil:unit

Generator Equations:
gen_nil:unit2_0(0) ⇔ nil
gen_nil:unit2_0(+(x, 1)) ⇔ unit(gen_nil:unit2_0(x))

The following defined symbols remain to be analysed:
++, flatten, rev

They will be analysed ascendingly in the following order:
++ < flatten
++ < rev

(9) NoRewriteLemmaProof (LOWER BOUND(ID) transformation)

Could not prove a rewrite lemma for the defined symbol ++.

(10) Obligation:

TRS:
Rules:
flatten(nil) → nil
flatten(unit(x)) → flatten(x)
flatten(++(x, y)) → ++(flatten(x), flatten(y))
flatten(++(unit(x), y)) → ++(flatten(x), flatten(y))
flatten(flatten(x)) → flatten(x)
rev(nil) → nil
rev(unit(x)) → unit(x)
rev(++(x, y)) → ++(rev(y), rev(x))
rev(rev(x)) → x
++(x, nil) → x
++(nil, y) → y
++(++(x, y), z) → ++(x, ++(y, z))

Types:
flatten :: nil:unit → nil:unit
nil :: nil:unit
unit :: nil:unit → nil:unit
++ :: nil:unit → nil:unit → nil:unit
rev :: nil:unit → nil:unit
hole_nil:unit1_0 :: nil:unit
gen_nil:unit2_0 :: Nat → nil:unit

Generator Equations:
gen_nil:unit2_0(0) ⇔ nil
gen_nil:unit2_0(+(x, 1)) ⇔ unit(gen_nil:unit2_0(x))

The following defined symbols remain to be analysed:
flatten, rev

(11) RewriteLemmaProof (LOWER BOUND(ID) transformation)

Proved the following rewrite lemma:
flatten(gen_nil:unit2_0(n19_0)) → gen_nil:unit2_0(0), rt ∈ Ω(1 + n190)

Induction Base:
flatten(gen_nil:unit2_0(0)) →RΩ(1)
nil

Induction Step:
flatten(gen_nil:unit2_0(+(n19_0, 1))) →RΩ(1)
flatten(gen_nil:unit2_0(n19_0)) →IH
gen_nil:unit2_0(0)

We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).

(12) Complex Obligation (BEST)

(13) Obligation:

TRS:
Rules:
flatten(nil) → nil
flatten(unit(x)) → flatten(x)
flatten(++(x, y)) → ++(flatten(x), flatten(y))
flatten(++(unit(x), y)) → ++(flatten(x), flatten(y))
flatten(flatten(x)) → flatten(x)
rev(nil) → nil
rev(unit(x)) → unit(x)
rev(++(x, y)) → ++(rev(y), rev(x))
rev(rev(x)) → x
++(x, nil) → x
++(nil, y) → y
++(++(x, y), z) → ++(x, ++(y, z))

Types:
flatten :: nil:unit → nil:unit
nil :: nil:unit
unit :: nil:unit → nil:unit
++ :: nil:unit → nil:unit → nil:unit
rev :: nil:unit → nil:unit
hole_nil:unit1_0 :: nil:unit
gen_nil:unit2_0 :: Nat → nil:unit

Lemmas:
flatten(gen_nil:unit2_0(n19_0)) → gen_nil:unit2_0(0), rt ∈ Ω(1 + n190)

Generator Equations:
gen_nil:unit2_0(0) ⇔ nil
gen_nil:unit2_0(+(x, 1)) ⇔ unit(gen_nil:unit2_0(x))

The following defined symbols remain to be analysed:
rev

(14) NoRewriteLemmaProof (LOWER BOUND(ID) transformation)

Could not prove a rewrite lemma for the defined symbol rev.

(15) Obligation:

TRS:
Rules:
flatten(nil) → nil
flatten(unit(x)) → flatten(x)
flatten(++(x, y)) → ++(flatten(x), flatten(y))
flatten(++(unit(x), y)) → ++(flatten(x), flatten(y))
flatten(flatten(x)) → flatten(x)
rev(nil) → nil
rev(unit(x)) → unit(x)
rev(++(x, y)) → ++(rev(y), rev(x))
rev(rev(x)) → x
++(x, nil) → x
++(nil, y) → y
++(++(x, y), z) → ++(x, ++(y, z))

Types:
flatten :: nil:unit → nil:unit
nil :: nil:unit
unit :: nil:unit → nil:unit
++ :: nil:unit → nil:unit → nil:unit
rev :: nil:unit → nil:unit
hole_nil:unit1_0 :: nil:unit
gen_nil:unit2_0 :: Nat → nil:unit

Lemmas:
flatten(gen_nil:unit2_0(n19_0)) → gen_nil:unit2_0(0), rt ∈ Ω(1 + n190)

Generator Equations:
gen_nil:unit2_0(0) ⇔ nil
gen_nil:unit2_0(+(x, 1)) ⇔ unit(gen_nil:unit2_0(x))

No more defined symbols left to analyse.

(16) LowerBoundsProof (EQUIVALENT transformation)

The lowerbound Ω(n1) was proven with the following lemma:
flatten(gen_nil:unit2_0(n19_0)) → gen_nil:unit2_0(0), rt ∈ Ω(1 + n190)

(17) BOUNDS(n^1, INF)

(18) Obligation:

TRS:
Rules:
flatten(nil) → nil
flatten(unit(x)) → flatten(x)
flatten(++(x, y)) → ++(flatten(x), flatten(y))
flatten(++(unit(x), y)) → ++(flatten(x), flatten(y))
flatten(flatten(x)) → flatten(x)
rev(nil) → nil
rev(unit(x)) → unit(x)
rev(++(x, y)) → ++(rev(y), rev(x))
rev(rev(x)) → x
++(x, nil) → x
++(nil, y) → y
++(++(x, y), z) → ++(x, ++(y, z))

Types:
flatten :: nil:unit → nil:unit
nil :: nil:unit
unit :: nil:unit → nil:unit
++ :: nil:unit → nil:unit → nil:unit
rev :: nil:unit → nil:unit
hole_nil:unit1_0 :: nil:unit
gen_nil:unit2_0 :: Nat → nil:unit

Lemmas:
flatten(gen_nil:unit2_0(n19_0)) → gen_nil:unit2_0(0), rt ∈ Ω(1 + n190)

Generator Equations:
gen_nil:unit2_0(0) ⇔ nil
gen_nil:unit2_0(+(x, 1)) ⇔ unit(gen_nil:unit2_0(x))

No more defined symbols left to analyse.

(19) LowerBoundsProof (EQUIVALENT transformation)

The lowerbound Ω(n1) was proven with the following lemma:
flatten(gen_nil:unit2_0(n19_0)) → gen_nil:unit2_0(0), rt ∈ Ω(1 + n190)

(20) BOUNDS(n^1, INF)